if(document.URL.match(/admin\/first\/searchnosend.do/g)){
    var dbclick_times = 0;
    var eachopens = 40;
    var html = window.document.body.innerHTML;
    var reghref = /window\.open\('quicksend\.do\?id=(\d+)'/gi;
    var hrefs = html.match(reghref);
    for(var i=0; i<hrefs.length; i++){
        hrefs[i] = "http://www.firstdrs.com/admin/first/"+hrefs[i].substring(13,hrefs[i].length-1);
    }
    document.ondblclick = openhrefs;
}
function openhrefs(){
    for(var i=0; i<eachopens; i++){
        window.open(hrefs[i+dbclick_times*eachopens]);
    }
    dbclick_times ++;
}
 if(document.URL.match(/quicksend.do\?id=\d+/g)){    //正则用/  /g包围
     document.onkeydown = hotkey;
     document.onclick = selectfile;
     document.ondblclick = send;
     document.getElementById("mail.content___Frame").height="1";
 }
 function hotkey()
 {
	var key = window.event.keyCode;
	//alert(key);
	//if(key==113) //F2
    //    sendbutton.click();
 }
 function selectfile()
 {
     var selectfile = document.getElementById("dstfile0");
     selectfile.click();
 }
 function send()
 {
     var buttons = document.getElementsByName("button2");
     sendbutton = buttons[0];
     sendbutton.onclick = sure_send();
     sendbutton.click();
 }
 function sure_send(){
	var title=document.getElementById("title").value;
	var altvalue = "是否确认发送aaa？";
    var need_confirm = false;
     
    var passtype=document.getElementById("passtype").checked;
    var f1=document.getElementById("dstfile"+0).value;
    var f2=document.getElementById("dstfile"+1).value;
    var f3=document.getElementById("dstfile"+2).value;
    var f4=document.getElementById("dstfile"+3).value;
    var f5=document.getElementById("dstfile"+4).value;
    if(f1==''&&f2==''&&f3==''&&f4==''&&f5==''&&passtype){
        altvalue = "没有附件，继续吗？";
        need_confirm = true;
    }
    for(var i = 0;i<document.getElementsByName("upload").length;i++){
            var filename=document.getElementById("dstfile"+i).value;
            if(filename.length>0){
                var findex=filename.lastIndexOf("\\");
                var eindex=filename.lastIndexOf(".");
                filename=filename.substring(findex+1,eindex);
                //alert(filename);
                //alert(title);
                if(filename!=title){
                    altvalue = "咨询标题和附件名称"+(i+1)+"不一致，是否确认发送？";
                    need_confirm = false;
                }
            }

        }
     
    if(!need_confirm){
        document.getElementById("waitgif").style.display = "";
		document.getElementById("state").value = 2;//state;
		document.getElementById("sframe").action = "sendmail.do";
		document.getElementById("sframe").submit();
    }
    else{
         if(confirm(altvalue)){
            document.getElementById("waitgif").style.display = "";
            document.getElementById("state").value = 2;//state;
            document.getElementById("sframe").action = "sendmail.do";
            document.getElementById("sframe").submit();
	     }
    }

 }

 window._alert = window.alert;
 if(document.URL == "http://www.firstdrs.com/admin/first/sendmail.do"){
     window.alert = function(){};
     window.close();
     document.ondblclick = "window.close()";
 }
 //window.alert = window._alert;